@extends('admin.container')

@section('c-head')
    <script type="text/javascript">
        var PAGE_DATA = {
            REST_API: {
                // 全部权限
                get_all_rights : "{{ isset($role) ? route('admin.role-permission.index', [$role->id]) : route('admin.permission.index') }}",
                // 取消
                cancel_url : "{{ route('admin.role.index') }}",
            },
            group_name : "{{ isset($role) ? $role->display_name : ''  }}", // 管理员组名称
            mark_name : "{{ isset($role) ? $role->name : ''  }}", //  标识符
            desc : "{{ isset($role) ? $role->description : ''  }}" // 描述:
        };
    </script>
@stop

@section('c-body')
    <div class="comm-title">
                    <span id="page-title" class="title-msg">
                        <!-- 管理员组管理 > 新增 -->
                    </span>
    </div>
    <div class="comm-body">
        <form id="main-form" style="margin-top: 20px;" action="{{ isset($role) ? route('admin.role.update', [$role->id]) : route('admin.role.index') }}" method="post">
            {{ csrf_field() }}
            @if(isset($role)) <input name="_method" value="PUT" hidden="hidden"> @endif
            <div class="input-line">
                <div class="key-txt" style="width: 100px;">
                    管理员组名称:
                </div>
                <div class="right-val" style="width:250px; ">
                    <input id="group_name" name="name" style="width:200px; float:left;" />
                </div>
            </div>

            <div class="input-line">
                <div class="key-txt" style="width: 100px;">
                    标识符:
                </div>
                <div class="right-val" style="width:250px; ">
                    <input id="mark_name" name="mark_name" style="width:200px; float:left;" />
                </div>
            </div>

            <div class="admin-rights-line clearfix">
                <div class="key-txt" style="">
                    权限管理:
                </div>
                <div id="admin-rights-list" class="right-val rights-list clearfix" style="width: 700px; min-height:100px;">
                </div>
            </div>

           {{-- <div class="input-line" style="height:70px;">
                <div class="key-txt" style="width: 100px;">
                    描述:
                </div>
                <div class="right-val">
                    <textarea id="desc" name="desc" style="width:100%;"></textarea>
                </div>
            </div>--}}


            <div class="input-line" style="height:40px;margin-top: 30px;">
                <div class="key-txt" style="width: 100px;">
                </div>
                <div class="right-val">
                    <button id="submit-btn" type="button" class="am-btn am-btn-primary am-btn-sm">
                                <span style="display:block;">
                                    提交
                                </span>
                    </button>
                    <button id="cancel-btn" type="reset" class="am-btn am-btn-default am-btn-sm">
                        重置
                    </button>
                </div>
            </div>

        </form>

    </div>

    <script type="text/template" id="rights-templ">
        <% _.each(obj, function(groupItem){%>
        <div class="line clearfix">
            <% _.each(groupItem, function(rightItem){ %>
            <div class="right-unit">
                <input type="checkbox" id="<%=rightItem.id%>"
                       name="rights[]" <% if (rightItem.check == "1" ) { %> checked <% } %> value="<%=rightItem.id%>"  >
                <label for="<%=rightItem.id%>">
                    <%=rightItem.text%>
                </label>
            </div>
            <% });%>
        </div>
        <% });%>
    </script>

    <script src="/assets/b2b/admin/js/libs/jquery.validate.min.js"> </script>
    <script src="/assets/b2b/admin/js/libs/messages_zh.js"> </script>

    <script src="/assets/b2b/admin/js/pages/31.js"> </script>
@stop